package com.dragon.mmochat.model.skill;

import java.io.Serializable;

import com.dragon.mmochat.model.enumType.MmochatSkillType;
import com.dragon.mmochat.model.role.MmochatMonster;
import com.dragon.mmochat.model.role.MmochatPet;
import com.dragon.mmochat.model.role.MmochatRole;
import com.dragon.mmochat.service.MmochatSkillService;

//门派常规技能
public class MmochatSkill implements Comparable<MmochatSkill>, Serializable {
	private static final long serialVersionUID = 3253518526639559656L;
	private MmochatSkillType type; // 技能类型
	private int level = 0; // 技能等级

	public static final int 攻击技能 = 0;
	public static final int 障碍技能 = 1;
	public static final int 辅助技能 = 2;

	// 获得技能效果值
	public double getEffectValue() {
		return MmochatSkillService.getEffectValue(type, level);
	}

	// 获得目标数
	public int getTargetNum(MmochatRole role) {
		return MmochatSkillService.getTargetNum(role, type, level);
	}

	// 获得持续回合数
	public int getKeepRound() {
		return MmochatSkillService.getKeepRound(type, level);
	}

	// 获得消耗法力
	public int getCostSprit(boolean isPet) {
		return MmochatSkillService.getCostSprit(type, level, isPet);
	}

	// 学习技能的人物等级要求
	public int getLevelNeedToLearn() {
		return MmochatSkillService.getLevelNeedToLearn(type, level);
	}

	// 学习技能的人物道行要求(天)
	public int getDaoNeedToLearn() {
		return MmochatSkillService.getDaoNeedToLearn(type, level);
	}

	public MmochatSkillType getType() {
		return type;
	}

	public void setType(MmochatSkillType type) {
		this.type = type;
	}

	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}

	@Override
	public int compareTo(MmochatSkill other) {
		return other.getType().getActionType().getValue()
				- type.getActionType().getValue();
	}

}
